import java.util.ArrayList;

//生成验证码
public class Test5 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();//打印对象不是地址值而是存储数据
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        System.out.println(list);
        System.out.println("================");
        //3.删除元素
        boolean result = list.remove("ddd");
        System.out.println(list);
        System.out.println(result);
        String str = list.remove(2);
        System.out.println(str);
        System.out.println(list);
        System.out.println("===========");
        //修改元素
        String str1 = list.set(1,"ddd");
        System.out.println(str1);
        System.out.println(list);
        //查询元素
        String str2 = list.get(0);
        System.out.println(str2);
        //遍历元素
        for (int i = 0; i < list.size(); i++) {
            //i 索引
            String str3=list.get(i);
            System.out.println(str3);
        }

    }
}
